<template>
  <div :key="route.params.id">
    <!-- 返回按钮 -->
    <div class="back-button-container">
      <button class="btn btn-back" @click="goBack">
        <i class="fas fa-arrow-left me-2"></i>返回上一页
      </button>
    </div>
    
    <!-- 职位头部信息 -->
    <div class="job-header">
      <div class="container">
        <div class="row align-items-center">
          <div class="col-md-8">
            <h1 class="job-title">{{ jobDetail.jobTitle || '职位标题' }}</h1>
            <div class="company-info">
              <div class="company-logo">
                <img v-if="coverImageUrl" :src="coverImageUrl" alt="公司Logo" class="company-logo-img">
                <i v-else class="fas fa-building"></i>
              </div>
              <div>
                <h3 class="mb-1">{{ jobDetail.companyName || '公司名称' }}</h3>
                <p class="mb-0">
                  <i class="fas fa-map-marker-alt me-1"></i>
                  {{ jobDetail.workLocation || '工作地点' }} · {{ getIndustryText(jobDetail.industry) }}
                </p>
              </div>
            </div>
            <div class="job-meta">
              <div class="meta-item">
                <i class="fas fa-coins me-1"></i> {{ formatSalary(jobDetail) }}
              </div>
              <div class="meta-item">
                <i class="fas fa-briefcase me-1"></i> {{ getJobTypeText(jobDetail.jobType) }}
              </div>
              <div class="meta-item">
                <i class="fas fa-clock me-1"></i> {{ jobDetail.workDuration || '工作时长' }}
              </div>
              <div class="meta-item">
                <i class="fas fa-graduation-cap me-1"></i> {{ getEducationText(jobDetail.educationRequirement) }}
              </div>
              <div class="meta-item">
                <i class="fas fa-users me-1"></i> 招聘{{ jobDetail.recruitmentCount || 0 }}人
              </div>
            </div>
          </div>
          <div class="col-md-4 text-md-end">
            <div class="stats">
              <span><i class="far fa-eye me-1"></i> 浏览 {{ jobDetail.viewCount || 0 }} 次</span>
              <span><i class="far fa-clock me-1"></i> {{ formatTime(jobDetail.createdAt) }}发布</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container">
      <div class="row">
        <!-- 主要内容 -->
        <div class="col-lg-8">
          <div class="job-content">
            <h3 class="section-title">职位描述</h3>
            <p>{{ jobDetail.jobDescription || '暂无描述' }}</p>

            <h3 class="section-title">薪资备注</h3>
            <p>{{ jobDetail.benefits || '暂无描述' }}</p>

            <h3 class="section-title">福利待遇</h3>
            <p>{{ jobDetail.salaryRemark || '暂无描述' }}</p>

            <h3 class="section-title">办公方式</h3>
            <p>{{ getWorkModeText(jobDetail.workMode) }}</p>
            
            <h5>工作职责：</h5>
            <ul>
              <li v-for="(duty, index) in getJobDuties()" :key="index">{{ duty }}</li>
            </ul>
            
            <h5>职位要求：</h5>
            <ul>
              <li v-for="(requirement, index) in getJobRequirements()" :key="index">{{ requirement }}</li>
            </ul>
            
            <h3 class="section-title">职位标签</h3>
            <div>
              <span v-for="(tag, index) in getJobTags()" :key="index" class="tag">{{ tag }}</span>
            </div>
            
            <h3 class="section-title">工作地点</h3>
            <p>{{ jobDetail.workAddressDetail || '工作地点' }}</p>
            <div class="mt-3 map-container">
              <div id="map-container" style="width: 100%; height: 300px;"></div>
            </div>
            
            <h3 class="section-title">公司介绍</h3>
            <p>{{ jobDetail.companyDescription || '暂无公司介绍' }}</p>
            
            <div class="publisher-info">
              <div class="publisher-avatar">
                {{ jobDetail.contactPerson ? jobDetail.contactPerson.charAt(0) : '未' }}
              </div>
              <div>
                <h5 class="mb-1">{{ jobDetail.contactPerson || '发布者' }} · 招聘负责人</h5>
                <p class="mb-0 text-muted">已验证企业 · 最近活跃：{{ formatTime(jobDetail.createdAt) }}</p>
              </div>
            </div>
          </div>
          
          <!-- 相似职位推荐 -->
          <div class="similar-jobs">
            <h3 class="mb-4">相似职位推荐</h3>
            <div class="row">
              <div class="col-md-6" v-for="(job, index) in similarJobs" :key="index">
                <div class="job-card" @click="goToJobDetail(job, $event)">
                  <h5>{{ job.jobTitle }}</h5>
                  <p class="company">{{ job.companyName }}</p>
                  <div class="meta">
                    <span>{{ formatSalary(job) }}</span>
                    <span>{{ getJobTypeText(job.jobType) }}</span>
                    <span>{{ job.workLocation }}</span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 侧边栏 -->
        <div class="col-lg-4">
          <div class="job-sidebar">
            <h4 class="mb-4">职位信息</h4>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-money-bill-wave"></i>
              </div>
              <div class="info-content">
                <h5>薪资待遇</h5>
                <p>{{ formatSalary(jobDetail) }}</p>
              </div>
            </div>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-briefcase"></i>
              </div>
              <div class="info-content">
                <h5>工作性质</h5>
                <p>{{ getJobTypeText(jobDetail.jobType) }}</p>
              </div>
            </div>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-clock"></i>
              </div>
              <div class="info-content">
                <h5>工作时长</h5>
                <p>{{ jobDetail.workSchedule || '未指定' }}</p>
              </div>
            </div>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-map-marker-alt"></i>
              </div>
              <div class="info-content">
                <h5>工作地点</h5>
                <p>{{ jobDetail.workAddressDetail || '工作地点' }}</p>
              </div>
            </div>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-user-graduate"></i>
              </div>
              <div class="info-content">
                <h5>学历要求</h5>
                <p>{{ getEducationText(jobDetail.educationRequirement) }}</p>
              </div>
            </div>
            
            <div class="info-item">
              <div class="info-icon">
                <i class="fas fa-calendar-day"></i>
              </div>
              <div class="info-content">
                <h5>截止日期</h5>
                <p>{{ jobDetail.deadline ? formatDate(jobDetail.deadline) : '未指定' }}</p>
              </div>
            </div>
            
            <div class="mt-4 p-3 bg-light rounded">
              <h6><i class="fas fa-shield-alt me-2 text-primary"></i>安全提示</h6>
              <p class="small mb-0">请警惕虚假招聘，入职前勿缴纳任何费用，谨防上当受骗。</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
/* global AMap */
import { ref, onMounted, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getInternshipJobById, getInternshipJobByIndustry } from '@/api/Internship.js'
import { getPostCoverByIdService } from '@/api/post.js'
import { geocode } from '@/api/gaode.js'

// 获取路由参数
const route = useRoute()
const router = useRouter()
const jobId = route.params.id

// 返回上一页方法
const goBack = () => {
  router.go(-1)
}

// 职位详情数据
const jobDetail = ref({})

// 相似职位数据
const similarJobs = ref([])

// 封面图片URL
const coverImageUrl = ref('')

// 获取职位详情
const fetchJobDetail = async () => {
  try {
    const response = await getInternshipJobById(jobId)
    jobDetail.value = response.data || {}
    
    // 获取封面图片
    await fetchCoverImage()
    
    // 获取相似职位
    await fetchSimilarJobs()
  } catch (error) {
    console.error('获取职位详情失败:', error)
  }
}

// 获取封面图片
const fetchCoverImage = async () => {
  try {
    const coverImagesRes = await getPostCoverByIdService(jobDetail.value.postId)
    if (coverImagesRes && coverImagesRes.data && jobDetail.value.postId) {
      // 查找该帖子的所有图片并只取第一张
      const postImages = coverImagesRes.data.filter(img => img.postId === jobDetail.value.postId);
      if (postImages.length > 0) {
        const firstImage = postImages[0];
        // 添加前缀到图片URL
        coverImageUrl.value = firstImage.imageUrl.startsWith('http') 
          ? firstImage.imageUrl 
          : `http://localhost:8080${firstImage.imageUrl}`
      }
    }
  } catch (error) {
    console.error('获取封面图片失败:', error)
  }
}

// 获取相似职位
const fetchSimilarJobs = async () => {
  try {
    // 确保有行业信息
    if (jobDetail.value.industry) {
      const response = await getInternshipJobByIndustry(jobDetail.value.industry);
      
      if (response.data && response.data.length > 0) {
        // 随机选择两个职位（如果有的话）
        const jobs = response.data;
        const shuffled = [...jobs].sort(() => 0.5 - Math.random());
        similarJobs.value = shuffled.slice(0, 2);
      }
    }
  } catch (error) {
    console.error('获取相似职位失败:', error);
  }
};

// 跳转到职位详情页面
const goToJobDetail = (job) => {
  // 检查是否有id字段
  if (job.id) {
    // 总是在新窗口中打开链接
    const routeData = router.resolve({
      path: `/post/woekdetail/${job.id}`
    });
    window.open(routeData.href, '_blank');
  } else {
    console.error('职位信息缺少ID字段:', job);
  }
}

// 获取工作类型文本
const getJobTypeText = (type) => {
  const types = {
    internship: '实习',
    part_time: '兼职',
    full_time: '全职'
  }
  return types[type] || type || '未指定'
}

// 获取行业文本
const getIndustryText = (industry) => {
  const industries = {
    internet: '互联网/IT',
    finance: '金融/银行',
    education: '教育/培训',
    media: '媒体/广告',
    manufacturing: '制造业',
    service: '服务业',
    other: '其他'
  }
  return industries[industry] || industry || '未指定'
}

// 获取学历要求文本
const getEducationText = (education) => {
  const educations = {
    none: '不限',
    high_school: '高中及以上',
    college: '大专及以上',
    bachelor: '本科及以上',
    master: '硕士及以上',
    doctor: '博士及以上'
  }
  return educations[education] || education || '未指定'
}

// 获取工作方式文本
const getWorkModeText = (mode) => {
  const modes = {
    on_site: '现场办公',
    remote: '远程办公',
    hybrid: '混合办公'
  }
  return modes[mode] || mode || '未指定'
}

// 获取职位标签
const getJobTags = () => {
  if (Array.isArray(jobDetail.value.jobTags)) {
    return jobDetail.value.jobTags
  } else if (typeof jobDetail.value.jobTags === 'string') {
    try {
      return JSON.parse(jobDetail.value.jobTags)
    } catch {
      return []
    }
  }
  return []
}

// 获取工作职责
const getJobDuties = () => {
  if (Array.isArray(jobDetail.value.jobResponsibilities)) {
    return jobDetail.value.jobResponsibilities
  } else if (typeof jobDetail.value.jobResponsibilities === 'string') {
    try {
      return JSON.parse(jobDetail.value.jobResponsibilities)
    } catch {
      return [jobDetail.value.jobResponsibilities]
    }
  }
  return []
}

// 获取职位要求
const getJobRequirements = () => {
  if (Array.isArray(jobDetail.value.jobRequirements)) {
    return jobDetail.value.jobRequirements
  } else if (typeof jobDetail.value.jobRequirements === 'string') {
    try {
      return JSON.parse(jobDetail.value.jobRequirements)
    } catch {
      return [jobDetail.value.jobRequirements]
    }
  }
  return []
}

// 格式化薪资显示
const formatSalary = (job) => {
  if (!job) return '面议'
  
  if (job.salaryType === 'negotiable') return '薪资面议'
  if (job.salaryType === 'unpaid') return '无薪'
  
  const unit = getSalaryTypeText(job.salaryType)
  if (job.minSalary && job.maxSalary) {
    return `${job.minSalary} - ${job.maxSalary}元/${unit}`
  } else if (job.minSalary) {
    return `${job.minSalary}元/${unit}起`
  } else if (job.maxSalary) {
    return `${job.maxSalary}元/${unit}`
  }
  return '薪资面议'
}

// 获取薪资类型文本
const getSalaryTypeText = (salaryType) => {
  const types = {
    monthly: '月',
    hourly: '时',
    daily: '日',
    negotiable: '面议',
    unpaid: '无薪'
  }
  return types[salaryType] || '月'
}

// 格式化时间显示
const formatTime = (time) => {
  if (!time) return ''
  const date = new Date(time)
  const now = new Date()
  const diff = now - date
  
  const minute = 60 * 1000
  const hour = minute * 60
  const day = hour * 24
  
  if (diff < hour) {
    return `${Math.floor(diff / minute)}分钟前`
  } else if (diff < day) {
    return `${Math.floor(diff / hour)}小时前`
  } else if (diff < day * 7) {
    return `${Math.floor(diff / day)}天前`
  } else {
    return date.toLocaleDateString()
  }
}

// 格式化日期
const formatDate = (date) => {
  if (!date) return ''
  return new Date(date).toLocaleDateString()
}

// 组件挂载时获取职位详情
onMounted(() => {
  fetchJobDetail().then(() => {
    // 确保DOM已更新后再初始化地图
    setTimeout(initMap, 100);
  })
})

// 监听路由参数变化，当从一个职位详情页跳转到另一个职位详情页时，重新获取数据
watch(() => route.params.id, (newId, oldId) => {
  if (newId !== oldId) {
    fetchJobDetail().then(() => {
      // 确保DOM已更新后再初始化地图
      setTimeout(initMap, 100);
    })
  }
})

// 初始化地图
const initMap = async () => {
  // 检查是否已有工作地点信息
  if (!jobDetail.value.workAddressDetail) {
    console.warn('没有工作地点信息，无法显示地图');
    return;
  }

  try {
    // 使用geocode方法将工作地点转换为经纬度
    const response = await geocode(jobDetail.value.workAddressDetail);
    
    if (response.code === 0 && response.data) {
      // 解析后端返回的JSON字符串
      let geocodeData;
      try {
        geocodeData = typeof response.data === 'string' ? JSON.parse(response.data) : response.data;
      } catch (parseError) {
        console.error('解析地理编码数据失败:', parseError);
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
        return;
      }
      
      // 检查高德地图API返回的状态
      if (geocodeData.status !== '1') {
        console.error('高德地图API返回错误:', geocodeData.info);
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
        return;
      }
      
      // 检查是否有地理编码结果
      if (!geocodeData.geocodes || geocodeData.geocodes.length === 0) {
        console.error('未找到地理编码结果');
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
        return;
      }
      
      // 解析高德地图返回的location数据 "longitude（经度）,latitude（维度）"
      const location = geocodeData.geocodes[0].location;
      if (!location) {
        console.error('地理编码返回的location为空');
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
        return;
      }
      
      const [longitude, latitude] = location.split(',').map(Number);
      
      // 检查经纬度是否有效
      if (isNaN(longitude) || isNaN(latitude)) {
        console.error('地理编码返回的经纬度无效:', location);
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
        return;
      }
      
      // 动态加载高德地图API
      await loadAMapScript();
      
      // 添加判断确保AMap已经定义
      if (typeof AMap === 'undefined') {
        console.error('高德地图API加载失败');
        document.getElementById('map-container').innerHTML = 
          '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地图加载失败</div>';
        return;
      }
      
      // 创建地图
      const map = new AMap.Map('map-container', {
        zoom: 14,
        center: [longitude, latitude],
        resizeEnable: true
      });
      
      // 添加标记
      const marker = new AMap.Marker({
        position: [longitude, latitude],
        title: jobDetail.value.workAddressDetail
      });
      
      map.add(marker);
      
      // 添加信息窗口
      const infoWindow = new AMap.InfoWindow({
        content: `<div style="padding: 5px;">${jobDetail.value.workAddressDetail}</div>`,
        offset: new AMap.Pixel(0, -20)
      });
      
      // 打开信息窗口
      infoWindow.open(map, [longitude, latitude]);
    } else {
      console.error('地址解析失败:', response.message);
      document.getElementById('map-container').innerHTML = 
        '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
    }
  } catch (error) {
    console.error('获取地理编码失败:', error);
    document.getElementById('map-container').innerHTML = 
      '<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: #999;">地址解析失败，无法显示地图</div>';
  }
}

// 动态加载高德地图API
const loadAMapScript = () => {
  return new Promise((resolve, reject) => {
    // 检查是否已经加载过
    if (window.AMap) {
      resolve();
      return;
    }
    
    // 创建script标签
    // (//webapi.amap.com/maps) - 这是高德地图 JavaScript API 的地址
    const script = document.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.src = '//webapi.amap.com/maps?v=1.4.15&key=6897a363d9ccd60e253dbc0c8bdcbfda'; // 高德地图key
    script.onload = () => {
      resolve();
    };
    script.onerror = () => {
      reject(new Error('加载高德地图API失败'));
    };
    
    document.head.appendChild(script);
  });
}
</script>

<style scoped>
:root {
  --primary-color: #3498db;
  --secondary-color: #2980b9;
  --accent-color: #e74c3c;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --success-color: #2ecc71;
}

/* 返回按钮样式 */
.back-button-container {
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.btn-back {
  background: #fff;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-back:hover {
  background: var(--primary-color);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.btn-back:active {
  transform: translateY(0);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.job-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem 0;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.job-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.company-info {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.company-logo {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  font-size: 24px;
  color: var(--primary-color);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden;
}

.company-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 1rem;
}

.meta-item {
  background: rgba(255,255,255,0.2);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.job-content {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  padding: 2rem;
  margin-bottom: 2rem;
}

.section-title {
  font-weight: 600;
  color: var(--primary-color);
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
  margin: 1.5rem 0 1rem;
}

.job-sidebar {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  padding: 1.5rem;
  position: sticky;
  top: 20px;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 1.5rem;
}

.btn-apply {
  background: #e74c3c; /* 红色背景 */
  color: white;
  font-weight: 600;
  padding: 12px;
  border-radius: 8px;
  border: none;
  transition: all 0.3s;
  display: block;
  width: 100%;
  opacity: 1; /* 确保完全不透明 */
  visibility: visible; /* 确保可见 */
}

.btn-apply:hover {
  background: #c0392b;
  transform: translateY(-2px);
}

.btn-secondary-action {
  background: var(--light-color);
  color: var(--dark-color);
  font-weight: 500;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  transition: all 0.3s;
}

.btn-secondary-action:hover {
  background: #e9ecef;
}

.info-item {
  display: flex;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.info-icon {
  width: 40px;
  height: 40px;
  background: var(--light-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  color: var(--primary-color);
}

.info-content h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.info-content p {
  margin: 5px 0 0;
  color: #666;
}

.tag {
  display: inline-block;
  background: #e1f0fa;
  color: var(--primary-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-right: 8px;
  margin-bottom: 8px;
}

.publisher-info {
  display: flex;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.publisher-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  margin-right: 15px;
}

.similar-jobs {
  margin-top: 3rem;
}

.job-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s;
  border-left: 4px solid var(--primary-color);
  cursor: pointer;
}

.job-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.job-card h5 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.job-card .company {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.job-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0.5rem;
}

.job-card .meta span {
  background: #f1f8ff;
  color: var(--primary-color);
  padding: 3px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  color: #777;
  font-size: 0.9rem;
}

.map-container {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.map-placeholder {
  height: 200px;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .job-meta {
    gap: 10px;
  }
  
  .meta-item {
    font-size: 0.8rem;
    padding: 4px 12px;
  }
  
  .job-content, .job-sidebar {
    padding: 1.5rem;
  }
}
</style>